<template>
  <div class="item" @click="$router.push('/detail/' + item.id)">
    <div class="top">
      <!-- <div class="left">1</div> -->
      <img :src="item.avatar" alt="" />
      <div class="right">
        <div class="title">{{ item.stem }}</div>
        <div class="username">
          <span>{{ item.creator }}</span>
          <span> | </span>
          <span>{{ item.createdAt }}</span>
        </div>
      </div>
    </div>
    <div class="middle" v-html="item.content"></div>
    <div class="bottom">
      <span>点赞 {{ item.likeCount }}</span>
      <span> | </span>
      <span>浏览 {{ item.views }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default() {
        return {};
      },
    },
  },
};
</script>

<style lang="less" scoped>
.item {
  padding: 10px;
  margin: 10px;
  border: 1px solid #000;
  .top {
    display: flex;

    img {
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }

    .right {
      flex: 1;
      .username {
        color: grey;
        font-size: 12px;
      }
    }
  }

  .bottom {
    color: grey;
    font-size: 12px;
  }
}
.middle {
  color: grey;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>
